/**
 * 
 */
package com.google.code.cisx.client.service;

import com.google.code.cisx.client.dto.ProjectGroupViewHelper;
import com.google.code.cisx.client.dto.QueryViewHelper;
import com.google.gwt.user.client.rpc.AsyncCallback;

import java.util.List;

/**
 * 
 * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
 * @since 1.0
 * @version $Id: RemoteProjectGroupServiceAsync.java 113 2008-01-12 05:58:36Z
 *          rahul.thakur.xdev $
 */
public interface RemoteProjectGroupServiceAsync {
  /**
   * Looks up the underlying store and returns a {@link T} instance that matches
   * the specified id.
   * 
   * @param klass {@link Class} for type entity to lookup and return an instance
   *          of.
   * @param id Entity Type {@link T}'s id to match.
   * 
   * @return matching entity type {@link T} instance.
   * @throws RemoteServiceException
   * 
   */
  public void lookup(Long id, AsyncCallback<ProjectGroupViewHelper> callback)
      throws RemoteServiceException;

  /**
   * Persists the passed in entity type {@link ProjectGroupViewHelper} instance
   * to the underlying store.
   * <p>
   * If the entity instance already exists in the database it is updated, else a
   * new instance is created and an store-generated identifier assigned to it.
   * 
   * @param entity Type {@link ProjectGroupViewHelper} instance to be
   *          created/saved.
   * @return updated entity type {@link ProjectGroupViewHelper} instance.
   * @throws RemoteServiceException if there was an error saving the entity.
   */
  public void save(ProjectGroupViewHelper entity, AsyncCallback<ProjectGroupViewHelper> callback)
      throws RemoteServiceException;

  /**
   * Removes the passed entity type {@link ProjectGroupViewHelper} instance from
   * the underlying store.
   * 
   * @param entity Type {@link ProjectGroupViewHelper} instance to remove.
   * @throws RemoteServiceException if there was an error removing the entity.
   */
  public void delete(ProjectGroupViewHelper entity, AsyncCallback<ProjectGroupViewHelper> callback)
      throws RemoteServiceException;

  /**
   * Obtains a {@link List} of instances of entity type
   * {@link ProjectGroupViewHelper} which match the criteria specified by the
   * passed in query instance.
   * 
   * @param query instance that wraps up the criteria for querying matching
   *          instances in the system.
   * @param startIdx index for first result.
   * @param range number of results to fetch starting from first result.
   * @return {@link List} of instances of entity type
   *         {@link ProjectGroupViewHelper} which match the specified query.
   * @throws RemoteServiceException
   */
  public void query(QueryViewHelper<ProjectGroupViewHelper> query, int startIdx, int range,
      AsyncCallback<ProjectGroupViewHelper> callback) throws RemoteServiceException;
}
